package com.ht.temp.controller;


import com.ht.temp.entity.OnLineTemperature;
import com.ht.temp.service.IOnLineTemperatureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author mayke_zhou
 * @since 2018-12-19
 */
@RestController
@RequestMapping("/onlineTemperature")
public class OnLineTemperatureController {
        @Autowired
        private IOnLineTemperatureService onLineTemperatureService;

        @RequestMapping(value = "/selectByOnLineTemperature",method = RequestMethod.GET)
        public List<OnLineTemperature> selectByOnLineTemperature(OnLineTemperature onLineTemperature){
          return  onLineTemperatureService.selectByOnLineTemperature(onLineTemperature);
        }

        @RequestMapping(value = "/deleteByPrimaryKey",method = RequestMethod.GET)
        public  Integer deleteByPrimaryKey(Integer temId){
             return  onLineTemperatureService.deleteByPrimaryKey(temId);
        }


        @RequestMapping("/getTempByMin")
        public List<OnLineTemperature> getTempByMin(Integer deviceId){
                return  onLineTemperatureService.getTempByMIn(deviceId);
        }

        @RequestMapping(value = "/getTempByMinAvg",method = RequestMethod.GET)
        public OnLineTemperature getTempByMinAvg(Integer deviceId){
                return  onLineTemperatureService.getAvgMin(deviceId);
        }

        @RequestMapping(value = "/getRecentlyTemperature",method = RequestMethod.GET)
        public  List<OnLineTemperature> getRecentlyTemperature(OnLineTemperature onLineTemperature){
                return  onLineTemperatureService.getRecentlyTemperature(onLineTemperature);
        }


        @RequestMapping(value = "/findPastrecords",method = RequestMethod.GET)
        public  List<OnLineTemperature> findPastrecords(Integer deviceId,String searchTime){
                return  onLineTemperatureService.findPastrecords(deviceId,searchTime);
        }


        @RequestMapping(value = "/test")
        public String test(){
                return "hello";
        }
}
